1 module directx.d2d1_1; 2 //--------------------------------------------------------------------------- 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // 5 // This file is automatically generated. Please do not edit it directly. 6 // 7 // File name: D2D1_1.h 8 //--------------------------------------------------------------------------- 9 10 version(Windows): 11 12 version(Direct2D_1_3) 13 version = Direct2D_1_2; 14 version(Direct2D_1_2) 15 version = Direct2D_1_1; 16 version(Direct2D_1_1): 17 version = Direct2D_1_0; 18 19 version(DirectWrite): 20 version(WinCodec): 21 version(Direct2D_1_1): 22 23 public import directx.com; 24 public import directx.d2d1; 25 public import directx.d2d1effects; 26 public import directx.dxgi; 27 public import directx.dwrite, directx.wincodec; 28 29 import directx.d2d1effectauthor; 30 import core.sys.windows.objidl; 31 32 /// <summary> 33 /// Function pointer to construct a new effect once registered. 34 /// </summary> 35 alias PD2D1_EFFECT_FACTORY = extern(Windows) HRESULT function(IUnknown* effectImpl); 36 enum D2D1_INVALID_PROPERTY_INDEX = uint.max; 37 alias D2D1_RECT_L = D2D_RECT_L; 38 alias D2D1_POINT_2L = D2D_POINT_2L; 39 40 /// <summary> 41 /// This defines the valid property types that can be used in an effect property 42 /// interface. 43 /// </summary> 44 alias D2D1_PROPERTY_TYPE = uint; 45 enum : D2D1_PROPERTY_TYPE 46 { 47 D2D1_PROPERTY_TYPE_UNKNOWN = 0, 48 D2D1_PROPERTY_TYPE_STRING = 1, 49 D2D1_PROPERTY_TYPE_BOOL = 2, 50 D2D1_PROPERTY_TYPE_UINT32 = 3, 51 D2D1_PROPERTY_TYPE_INT32 = 4, 52 D2D1_PROPERTY_TYPE_FLOAT = 5, 53 D2D1_PROPERTY_TYPE_VECTOR2 = 6, 54 D2D1_PROPERTY_TYPE_VECTOR3 = 7, 55 D2D1_PROPERTY_TYPE_VECTOR4 = 8, 56 D2D1_PROPERTY_TYPE_BLOB = 9, 57 D2D1_PROPERTY_TYPE_IUNKNOWN = 10, 58 D2D1_PROPERTY_TYPE_ENUM = 11, 59 D2D1_PROPERTY_TYPE_ARRAY = 12, 60 D2D1_PROPERTY_TYPE_CLSID = 13, 61 D2D1_PROPERTY_TYPE_MATRIX_3X2 = 14, 62 D2D1_PROPERTY_TYPE_MATRIX_4X3 = 15, 63 D2D1_PROPERTY_TYPE_MATRIX_4X4 = 16, 64 D2D1_PROPERTY_TYPE_MATRIX_5X4 = 17, 65 D2D1_PROPERTY_TYPE_COLOR_CONTEXT = 18, 66 D2D1_PROPERTY_TYPE_FORCE_DWORD = 0xffffffff 67 68 } 69 70 71 /// <summary> 72 /// This defines the list of system properties present on the root effect property 73 /// interface. 74 /// </summary> 75 alias D2D1_PROPERTY = uint; 76 enum : D2D1_PROPERTY 77 { 78 D2D1_PROPERTY_CLSID = 0x80000000, 79 D2D1_PROPERTY_DISPLAYNAME = 0x80000001, 80 D2D1_PROPERTY_AUTHOR = 0x80000002, 81 D2D1_PROPERTY_CATEGORY = 0x80000003, 82 D2D1_PROPERTY_DESCRIPTION = 0x80000004, 83 D2D1_PROPERTY_INPUTS = 0x80000005, 84 D2D1_PROPERTY_CACHED = 0x80000006, 85 D2D1_PROPERTY_PRECISION = 0x80000007, 86 D2D1_PROPERTY_MIN_INPUTS = 0x80000008, 87 D2D1_PROPERTY_MAX_INPUTS = 0x80000009 88 } 89 90 91 /// <summary> 92 /// This defines the indices of sub-properties that may be present on any parent 93 /// property. 94 /// </summary> 95 alias D2D1_SUBPROPERTY = uint; 96 enum : D2D1_SUBPROPERTY 97 { 98 D2D1_SUBPROPERTY_DISPLAYNAME = 0x80000000, 99 D2D1_SUBPROPERTY_ISREADONLY = 0x80000001, 100 D2D1_SUBPROPERTY_MIN = 0x80000002, 101 D2D1_SUBPROPERTY_MAX = 0x80000003, 102 D2D1_SUBPROPERTY_DEFAULT = 0x80000004, 103 D2D1_SUBPROPERTY_FIELDS = 0x80000005, 104 D2D1_SUBPROPERTY_INDEX = 0x80000006 105 } 106 107 108 /// <summary> 109 /// Specifies how the bitmap can be used. 110 /// </summary> 111 alias D2D1_BITMAP_OPTIONS = uint; 112 enum : D2D1_BITMAP_OPTIONS 113 { 114 115 /// <summary> 116 /// The bitmap is created with default properties. 117 /// </summary> 118 D2D1_BITMAP_OPTIONS_NONE = 0x00000000, 119 120 /// <summary> 121 /// The bitmap can be specified as a target in ID2D1DeviceContext::SetTarget 122 /// </summary> 123 D2D1_BITMAP_OPTIONS_TARGET = 0x00000001, 124 125 /// <summary> 126 /// The bitmap cannot be used as an input to DrawBitmap, DrawImage, in a bitmap 127 /// brush or as an input to an effect. 128 /// </summary> 129 D2D1_BITMAP_OPTIONS_CANNOT_DRAW = 0x00000002, 130 131 /// <summary> 132 /// The bitmap can be read from the CPU. 133 /// </summary> 134 D2D1_BITMAP_OPTIONS_CPU_READ = 0x00000004, 135 136 /// <summary> 137 /// The bitmap works with the ID2D1GdiInteropRenderTarget::GetDC API. 138 /// </summary> 139 D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = 0x00000008 140 } 141 142 143 /// <summary> 144 /// Specifies the composite mode that will be applied. 145 /// </summary> 146 alias D2D1_COMPOSITE_MODE = uint; 147 enum : D2D1_COMPOSITE_MODE 148 { 149 D2D1_COMPOSITE_MODE_SOURCE_OVER = 0, 150 D2D1_COMPOSITE_MODE_DESTINATION_OVER = 1, 151 D2D1_COMPOSITE_MODE_SOURCE_IN = 2, 152 D2D1_COMPOSITE_MODE_DESTINATION_IN = 3, 153 D2D1_COMPOSITE_MODE_SOURCE_OUT = 4, 154 D2D1_COMPOSITE_MODE_DESTINATION_OUT = 5, 155 D2D1_COMPOSITE_MODE_SOURCE_ATOP = 6, 156 D2D1_COMPOSITE_MODE_DESTINATION_ATOP = 7, 157 D2D1_COMPOSITE_MODE_XOR = 8, 158 D2D1_COMPOSITE_MODE_PLUS = 9, 159 D2D1_COMPOSITE_MODE_SOURCE_COPY = 10, 160 D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = 11, 161 D2D1_COMPOSITE_MODE_MASK_INVERT = 12 162 } 163 164 165 /// <summary> 166 /// This specifies the precision that should be used in buffers allocated by D2D. 167 /// </summary> 168 alias D2D1_BUFFER_PRECISION = uint; 169 enum : D2D1_BUFFER_PRECISION 170 { 171 D2D1_BUFFER_PRECISION_UNKNOWN = 0, 172 D2D1_BUFFER_PRECISION_8BPC_UNORM = 1, 173 D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2, 174 D2D1_BUFFER_PRECISION_16BPC_UNORM = 3, 175 D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4, 176 D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5 177 } 178 179 180 /// <summary> 181 /// This describes how the individual mapping operation should be performed. 182 /// </summary> 183 alias D2D1_MAP_OPTIONS = uint; 184 enum : D2D1_MAP_OPTIONS 185 { 186 187 /// <summary> 188 /// The mapped pointer has undefined behavior. 189 /// </summary> 190 D2D1_MAP_OPTIONS_NONE = 0, 191 192 /// <summary> 193 /// The mapped pointer can be read from. 194 /// </summary> 195 D2D1_MAP_OPTIONS_READ = 1, 196 197 /// <summary> 198 /// The mapped pointer can be written to. 199 /// </summary> 200 D2D1_MAP_OPTIONS_WRITE = 2, 201 202 /// <summary> 203 /// The previous contents of the bitmap are discarded when it is mapped. 204 /// </summary> 205 D2D1_MAP_OPTIONS_DISCARD = 4 206 } 207 208 209 /// <summary> 210 /// This is used to specify the quality of image scaling with 211 /// ID2D1DeviceContext::DrawImage and with the 2D Affine Transform Effect. 212 /// </summary> 213 alias D2D1_INTERPOLATION_MODE = uint; 214 enum : D2D1_INTERPOLATION_MODE 215 { 216 D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, 217 D2D1_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, 218 D2D1_INTERPOLATION_MODE_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC, 219 D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR, 220 D2D1_INTERPOLATION_MODE_ANISOTROPIC = D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC, 221 D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC 222 } 223 224 225 /// <summary> 226 /// This specifies what units should be accepted by the D2D API. 227 /// </summary> 228 alias D2D1_UNIT_MODE = uint; 229 enum : D2D1_UNIT_MODE 230 { 231 D2D1_UNIT_MODE_DIPS = 0, 232 D2D1_UNIT_MODE_PIXELS = 1 233 } 234 235 236 /// <summary> 237 /// Defines a color space. 238 /// </summary> 239 alias D2D1_COLOR_SPACE = uint; 240 enum : D2D1_COLOR_SPACE 241 { 242 243 /// <summary> 244 /// The color space is described by accompanying data, such as a color profile. 245 /// </summary> 246 D2D1_COLOR_SPACE_CUSTOM = 0, 247 248 /// <summary> 249 /// The sRGB color space. 250 /// </summary> 251 D2D1_COLOR_SPACE_SRGB = 1, 252 253 /// <summary> 254 /// The scRGB color space. 255 /// </summary> 256 D2D1_COLOR_SPACE_SCRGB = 2 257 } 258 259 260 /// <summary> 261 /// This specifies options that apply to the device context for its lifetime. 262 /// </summary> 263 alias D2D1_DEVICE_CONTEXT_OPTIONS = uint; 264 enum : D2D1_DEVICE_CONTEXT_OPTIONS 265 { 266 D2D1_DEVICE_CONTEXT_OPTIONS_NONE = 0, 267 268 /// <summary> 269 /// Geometry rendering will be performed on many threads in parallel, a single 270 /// thread is the default. 271 /// </summary> 272 D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = 1 273 } 274 275 276 /// <summary> 277 /// Defines how the world transform, dots per inch (dpi), and stroke width affect 278 /// the shape of the pen used to stroke a primitive. 279 /// </summary> 280 alias D2D1_STROKE_TRANSFORM_TYPE = uint; 281 enum : D2D1_STROKE_TRANSFORM_TYPE 282 { 283 284 /// <summary> 285 /// The stroke respects the world transform, the DPI, and the stroke width. 286 /// </summary> 287 D2D1_STROKE_TRANSFORM_TYPE_NORMAL = 0, 288 289 /// <summary> 290 /// The stroke does not respect the world transform, but it does respect the DPI and 291 /// the stroke width. 292 /// </summary> 293 D2D1_STROKE_TRANSFORM_TYPE_FIXED = 1, 294 295 /// <summary> 296 /// The stroke is forced to one pixel wide. 297 /// </summary> 298 D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE = 2 299 } 300 301 302 /// <summary> 303 /// A blend mode that applies to all primitives drawn on the context. 304 /// </summary> 305 alias D2D1_PRIMITIVE_BLEND = uint; 306 enum : D2D1_PRIMITIVE_BLEND 307 { 308 D2D1_PRIMITIVE_BLEND_SOURCE_OVER = 0, 309 D2D1_PRIMITIVE_BLEND_COPY = 1, 310 D2D1_PRIMITIVE_BLEND_MIN = 2, 311 D2D1_PRIMITIVE_BLEND_ADD = 3, 312 D2D1_PRIMITIVE_BLEND_MAX = 4 313 } 314 315 316 /// <summary> 317 /// This specifies the threading mode used while simultaneously creating the device, 318 /// factory, and device context. 319 /// </summary> 320 alias D2D1_THREADING_MODE = uint; 321 enum : D2D1_THREADING_MODE 322 { 323 324 /// <summary> 325 /// Resources may only be invoked serially. Reference counts on resources are 326 /// interlocked, however, resource and render target state is not protected from 327 /// multi-threaded access 328 /// </summary> 329 D2D1_THREADING_MODE_SINGLE_THREADED = D2D1_FACTORY_TYPE_SINGLE_THREADED, 330 331 /// <summary> 332 /// Resources may be invoked from multiple threads. Resources use interlocked 333 /// reference counting and their state is protected. 334 /// </summary> 335 D2D1_THREADING_MODE_MULTI_THREADED = D2D1_FACTORY_TYPE_MULTI_THREADED 336 } 337 338 339 /// <summary> 340 /// This specifies how colors are interpolated. 341 /// </summary> 342 alias D2D1_COLOR_INTERPOLATION_MODE = uint; 343 enum : D2D1_COLOR_INTERPOLATION_MODE 344 { 345 346 /// <summary> 347 /// Colors will be interpolated in straight alpha space. 348 /// </summary> 349 D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = 0, 350 351 /// <summary> 352 /// Colors will be interpolated in premultiplied alpha space. 353 /// </summary> 354 D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = 1 355 } 356 357 alias D2D1_VECTOR_2F = D2D_VECTOR_2F; 358 alias D2D1_VECTOR_3F = D2D_VECTOR_3F; 359 alias D2D1_VECTOR_4F = D2D_VECTOR_4F; 360 361 /// <summary> 362 /// Extended bitmap properties. 363 /// </summary> 364 struct D2D1_BITMAP_PROPERTIES1 365 { 366 D2D1_PIXEL_FORMAT pixelFormat; 367 FLOAT dpiX; 368 FLOAT dpiY; 369 370 /// <summary> 371 /// Specifies how the bitmap can be used. 372 /// </summary> 373 D2D1_BITMAP_OPTIONS bitmapOptions; 374 ID2D1ColorContext colorContext; 375 } 376 377 378 /// <summary> 379 /// Describes mapped memory from the ID2D1Bitmap1::Map API. 380 /// </summary> 381 struct D2D1_MAPPED_RECT 382 { 383 UINT32 pitch; 384 BYTE* bits; 385 } 386 387 388 /// <summary> 389 /// This controls advanced settings of the Direct2D imaging pipeline. 390 /// </summary> 391 struct D2D1_RENDERING_CONTROLS 392 { 393 /// <summary> 394 /// The default buffer precision, used if the precision isn't otherwise specified. 395 /// </summary> 396 D2D1_BUFFER_PRECISION bufferPrecision; 397 398 /// <summary> 399 /// The size of allocated tiles used to render imaging effects. 400 /// </summary> 401 D2D1_SIZE_U tileSize; 402 } 403 404 405 /// <summary> 406 /// This identifies a certain input connection of a certain effect. 407 /// </summary> 408 struct D2D1_EFFECT_INPUT_DESCRIPTION 409 { 410 /// <summary> 411 /// The effect whose input connection is being specified. 412 /// </summary> 413 ID2D1Effect effect; 414 415 /// <summary> 416 /// The index of the input connection into the specified effect. 417 /// </summary> 418 UINT32 inputIndex; 419 420 /// <summary> 421 /// The rectangle which would be available on the specified input connection during 422 /// render operations. 423 /// </summary> 424 D2D1_RECT_F inputRectangle; 425 } 426 427 alias D2D1_MATRIX_4X3_F = D2D_MATRIX_4X3_F; 428 alias D2D1_MATRIX_4X4_F = D2D_MATRIX_4X4_F; 429 alias D2D1_MATRIX_5X4_F = D2D_MATRIX_5X4_F; 430 431 /// <summary> 432 /// Describes a point along a path. 433 /// </summary> 434 struct D2D1_POINT_DESCRIPTION 435 { 436 D2D1_POINT_2F point; 437 D2D1_POINT_2F unitTangentVector; 438 UINT32 endSegment; 439 UINT32 endFigure; 440 FLOAT lengthToEndSegment; 441 } 442 443 444 /// <summary> 445 /// Creation properties for an image brush. 446 /// </summary> 447 struct D2D1_IMAGE_BRUSH_PROPERTIES 448 { 449 D2D1_RECT_F sourceRectangle; 450 D2D1_EXTEND_MODE extendModeX; 451 D2D1_EXTEND_MODE extendModeY; 452 D2D1_INTERPOLATION_MODE interpolationMode; 453 } 454 455 456 /// <summary> 457 /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. 458 /// </summary> 459 struct D2D1_BITMAP_BRUSH_PROPERTIES1 460 { 461 D2D1_EXTEND_MODE extendModeX; 462 D2D1_EXTEND_MODE extendModeY; 463 D2D1_INTERPOLATION_MODE interpolationMode; 464 } 465 466 467 /// <summary> 468 /// This defines how geometries should be drawn and widened. 469 /// </summary> 470 struct D2D1_STROKE_STYLE_PROPERTIES1 471 { 472 D2D1_CAP_STYLE startCap; 473 D2D1_CAP_STYLE endCap; 474 D2D1_CAP_STYLE dashCap; 475 D2D1_LINE_JOIN lineJoin; 476 FLOAT miterLimit; 477 D2D1_DASH_STYLE dashStyle; 478 FLOAT dashOffset; 479 480 /// <summary> 481 /// How the nib of the stroke is influenced by the context properties. 482 /// </summary> 483 D2D1_STROKE_TRANSFORM_TYPE transformType; 484 } 485 486 487 /// <summary> 488 /// Specifies how the layer contents should be prepared. 489 /// </summary> 490 alias D2D1_LAYER_OPTIONS1 = uint; 491 enum : D2D1_LAYER_OPTIONS1 492 { 493 D2D1_LAYER_OPTIONS1_NONE = 0, 494 D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = 1, 495 D2D1_LAYER_OPTIONS1_IGNORE_ALPHA = 2 496 } 497 498 499 /// <summary> 500 /// All parameters related to pushing a layer. 501 /// </summary> 502 struct D2D1_LAYER_PARAMETERS1 503 { 504 D2D1_RECT_F contentBounds; 505 ID2D1Geometry geometricMask; 506 D2D1_ANTIALIAS_MODE maskAntialiasMode; 507 D2D1_MATRIX_3X2_F maskTransform; 508 FLOAT opacity; 509 ID2D1Brush opacityBrush; 510 D2D1_LAYER_OPTIONS1 layerOptions; 511 } 512 513 514 /// <summary> 515 /// Defines when font resources should be subset during printing. 516 /// </summary> 517 alias D2D1_PRINT_FONT_SUBSET_MODE = uint; 518 enum : D2D1_PRINT_FONT_SUBSET_MODE 519 { 520 521 /// <summary> 522 /// Subset for used glyphs, send and discard font resource after every five pages 523 /// </summary> 524 D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT = 0, 525 526 /// <summary> 527 /// Subset for used glyphs, send and discard font resource after each page 528 /// </summary> 529 D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = 1, 530 531 /// <summary> 532 /// Do not subset, reuse font for all pages, send it after first page 533 /// </summary> 534 D2D1_PRINT_FONT_SUBSET_MODE_NONE = 2 535 } 536 537 538 /// <summary> 539 /// This describes the drawing state. 540 /// </summary> 541 struct D2D1_DRAWING_STATE_DESCRIPTION1 542 { 543 D2D1_ANTIALIAS_MODE antialiasMode; 544 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; 545 D2D1_TAG tag1; 546 D2D1_TAG tag2; 547 D2D1_MATRIX_3X2_F transform; 548 D2D1_PRIMITIVE_BLEND primitiveBlend; 549 D2D1_UNIT_MODE unitMode; 550 } 551 552 553 /// <summary> 554 /// The creation properties for a ID2D1PrintControl object. 555 /// </summary> 556 struct D2D1_PRINT_CONTROL_PROPERTIES 557 { 558 D2D1_PRINT_FONT_SUBSET_MODE fontSubset; 559 560 /// <summary> 561 /// DPI for rasterization of all unsupported D2D commands or options, defaults to 562 /// 150.0 563 /// </summary> 564 FLOAT rasterDPI; 565 566 /// <summary> 567 /// Color space for vector graphics in XPS package 568 /// </summary> 569 D2D1_COLOR_SPACE colorSpace; 570 } 571 572 573 /// <summary> 574 /// This specifies the options while simultaneously creating the device, factory, 575 /// and device context. 576 /// </summary> 577 struct D2D1_CREATION_PROPERTIES 578 { 579 580 /// <summary> 581 /// Describes locking behavior of D2D resources 582 /// </summary> 583 D2D1_THREADING_MODE threadingMode; 584 D2D1_DEBUG_LEVEL debugLevel; 585 D2D1_DEVICE_CONTEXT_OPTIONS options; 586 } 587 588 mixin(uuid!(ID2D1GdiMetafileSink, "82237326-8111-4f7c-bcf4-b5c1175564fe")); 589 /// <summary> 590 /// User-implementable interface for introspecting on a metafile. 591 /// </summary> 592 interface ID2D1GdiMetafileSink : IUnknown 593 { 594 extern(Windows): 595 /// <summary> 596 /// Callback for examining a metafile record. 597 /// </summary> 598 HRESULT ProcessRecord( 599 DWORD recordType, 600 const(void)* recordData, 601 DWORD recordDataSize 602 ); 603 } // interface ID2D1GdiMetafileSink 604 605 606 mixin(uuid!(ID2D1GdiMetafile, "2f543dc3-cfc1-4211-864f-cfd91c6f3395")); 607 /// <summary> 608 /// Interface encapsulating a GDI/GDI+ metafile. 609 /// </summary> 610 interface ID2D1GdiMetafile : ID2D1Resource 611 { 612 extern(Windows): 613 /// <summary> 614 /// Play the metafile into a caller-supplied sink interface. 615 /// </summary> 616 HRESULT Stream(ID2D1GdiMetafileSink sink); 617 618 /// <summary> 619 /// Gets the bounds of the metafile. 620 /// </summary> 621 HRESULT GetBounds(D2D1_RECT_F* bounds); 622 } // interface ID2D1GdiMetafile 623 624 625 mixin(uuid!(ID2D1CommandSink, "54d7898a-a061-40a7-bec7-e465bcba2c4f")); 626 /// <summary> 627 /// Caller-supplied implementation of an interface to receive the recorded command 628 /// list. 629 /// </summary> 630 interface ID2D1CommandSink : IUnknown 631 { 632 extern(Windows): 633 HRESULT BeginDraw(); 634 HRESULT EndDraw(); 635 HRESULT SetAntialiasMode(D2D1_ANTIALIAS_MODE antialiasMode); 636 HRESULT SetTags(D2D1_TAG tag1, D2D1_TAG tag2); 637 HRESULT SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode); 638 HRESULT SetTextRenderingParams(IDWriteRenderingParams textRenderingParams); 639 HRESULT SetTransform(const(D2D1_MATRIX_3X2_F)* transform); 640 HRESULT SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); 641 HRESULT SetUnitMode(D2D1_UNIT_MODE unitMode); 642 HRESULT Clear(const(D2D1_COLOR_F)* color); 643 HRESULT DrawGlyphRun( 644 D2D1_POINT_2F baselineOrigin, 645 const(DWRITE_GLYPH_RUN)* glyphRun, 646 const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription, 647 ID2D1Brush foregroundBrush, 648 DWRITE_MEASURING_MODE measuringMode 649 ); 650 HRESULT DrawLine( 651 D2D1_POINT_2F point0, 652 D2D1_POINT_2F point1, 653 ID2D1Brush brush, 654 FLOAT strokeWidth, 655 ID2D1StrokeStyle strokeStyle 656 ); 657 HRESULT DrawGeometry( 658 ID2D1Geometry geometry, 659 ID2D1Brush brush, 660 FLOAT strokeWidth, 661 ID2D1StrokeStyle strokeStyle 662 ); 663 HRESULT DrawRectangle( 664 const(D2D1_RECT_F)* rect, 665 ID2D1Brush brush, 666 FLOAT strokeWidth, 667 ID2D1StrokeStyle strokeStyle 668 ); 669 HRESULT DrawBitmap( 670 ID2D1Bitmap bitmap, 671 const(D2D1_RECT_F)* destinationRectangle, 672 FLOAT opacity, 673 D2D1_INTERPOLATION_MODE interpolationMode, 674 const(D2D1_RECT_F)* sourceRectangle, 675 const(D2D1_MATRIX_4X4_F)* perspectiveTransform 676 ); 677 HRESULT DrawImage( 678 ID2D1Image image, 679 const(D2D1_POINT_2F)* targetOffset, 680 const(D2D1_RECT_F)* imageRectangle, 681 D2D1_INTERPOLATION_MODE interpolationMode, 682 D2D1_COMPOSITE_MODE compositeMode 683 ); 684 HRESULT DrawGdiMetafile( 685 ID2D1GdiMetafile gdiMetafile, 686 const(D2D1_POINT_2F)* targetOffset 687 ); 688 HRESULT FillMesh( 689 ID2D1Mesh mesh, 690 ID2D1Brush brush 691 ); 692 HRESULT FillOpacityMask( 693 ID2D1Bitmap opacityMask, 694 ID2D1Brush brush, 695 const(D2D1_RECT_F)* destinationRectangle, 696 const(D2D1_RECT_F)* sourceRectangle 697 ); 698 HRESULT FillGeometry( 699 ID2D1Geometry geometry, 700 ID2D1Brush brush, 701 ID2D1Brush opacityBrush 702 ); 703 HRESULT FillRectangle( 704 const(D2D1_RECT_F)* rect, 705 ID2D1Brush brush 706 ); 707 HRESULT PushAxisAlignedClip( 708 const(D2D1_RECT_F)* clipRect, 709 D2D1_ANTIALIAS_MODE antialiasMode 710 ); 711 HRESULT PushLayer( 712 const(D2D1_LAYER_PARAMETERS1)* layerParameters1, 713 ID2D1Layer layer 714 ); 715 HRESULT PopAxisAlignedClip(); 716 HRESULT PopLayer(); 717 } // interface ID2D1CommandSink 718 719 720 mixin(uuid!(ID2D1CommandList, "b4f34a19-2383-4d76-94f6-ec343657c3dc")); 721 /// <summary> 722 /// The commandList interface. 723 /// </summary> 724 interface ID2D1CommandList : ID2D1Image 725 { 726 extern(Windows): 727 /// <summary> 728 /// Play the command list into a caller-supplied sink interface. 729 /// </summary> 730 HRESULT Stream(ID2D1CommandSink sink); 731 732 /// <summary> 733 /// Marks the command list as ready for use. 734 /// </summary> 735 HRESULT Close(); 736 } // interface ID2D1CommandList 737 738 mixin(uuid!(ID2D1PrintControl, "2c1d867d-c290-41c8-ae7e-34a98702e9a5")); 739 /// <summary> 740 /// Converts Direct2D primitives stored in an ID2D1CommandList into a fixed page 741 /// representation. The print sub-system then consumes the primitives. 742 /// </summary> 743 interface ID2D1PrintControl : IUnknown 744 { 745 extern(Windows): 746 HRESULT AddPage( 747 ID2D1CommandList commandList, 748 D2D_SIZE_F pageSize, 749 IStream pagePrintTicketStream, 750 D2D1_TAG* tag1 = null, 751 D2D1_TAG* tag2 = null 752 ); 753 754 HRESULT Close(); 755 } // interface ID2D1PrintControl 756 757 758 mixin(uuid!(ID2D1ImageBrush, "fe9e984d-3f95-407c-b5db-cb94d4e8f87c")); 759 /// <summary> 760 /// Provides a brush that can take any effect, command list or bitmap and use it to 761 /// fill a 2D shape. 762 /// </summary> 763 interface ID2D1ImageBrush : ID2D1Brush 764 { 765 extern(Windows): 766 void SetImage(ID2D1Image image); 767 void SetExtendModeX(D2D1_EXTEND_MODE extendModeX); 768 void SetExtendModeY(D2D1_EXTEND_MODE extendModeY); 769 void SetInterpolationMode(D2D1_INTERPOLATION_MODE interpolationMode); 770 void SetSourceRectangle(const(D2D1_RECT_F)* sourceRectangle); 771 void GetImage(ID2D1Image **image) const; 772 D2D1_EXTEND_MODE GetExtendModeX() const; 773 D2D1_EXTEND_MODE GetExtendModeY() const; 774 D2D1_INTERPOLATION_MODE GetInterpolationMode() const; 775 void GetSourceRectangle(D2D1_RECT_F* sourceRectangle) const; 776 } // interface ID2D1ImageBrush 777 778 779 mixin(uuid!(ID2D1BitmapBrush1, "41343a53-e41a-49a2-91cd-21793bbb62e5")); 780 /// <summary> 781 /// A bitmap brush allows a bitmap to be used to fill a geometry. Interpolation 782 /// mode is specified with D2D1_INTERPOLATION_MODE 783 /// </summary> 784 interface ID2D1BitmapBrush1 : ID2D1BitmapBrush 785 { 786 extern(Windows): 787 /// <summary> 788 /// Sets the interpolation mode used when this brush is used. 789 /// </summary> 790 void SetInterpolationMode1(D2D1_INTERPOLATION_MODE interpolationMode); 791 792 D2D1_INTERPOLATION_MODE GetInterpolationMode1() const; 793 } // interface ID2D1BitmapBrush1 794 795 796 mixin(uuid!(ID2D1StrokeStyle1, "10a72a66-e91c-43f4-993f-ddf4b82b0b4a")); 797 /// <summary> 798 /// Extends a stroke style to allow nominal width strokes. 799 /// </summary> 800 interface ID2D1StrokeStyle1 : ID2D1StrokeStyle 801 { 802 extern(Windows): 803 D2D1_STROKE_TRANSFORM_TYPE GetStrokeTransformType() const; 804 } // interface ID2D1StrokeStyle1 805 806 807 mixin(uuid!(ID2D1PathGeometry1, "62baa2d2-ab54-41b7-b872-787e0106a421")); 808 /// <summary> 809 /// The ID2D1PathGeometry1 interface adds functionality to ID2D1PathGeometry. In 810 /// particular, it provides the path geometry-specific 811 /// ComputePointAndSegmentAtLength method. 812 /// </summary> 813 interface ID2D1PathGeometry1 : ID2D1PathGeometry 814 { 815 extern(Windows): 816 HRESULT ComputePointAndSegmentAtLength( 817 FLOAT length, 818 UINT32 startSegment, 819 const(D2D1_MATRIX_3X2_F)* worldTransform, 820 FLOAT flatteningTolerance, 821 D2D1_POINT_DESCRIPTION* pointDescription 822 ) const; 823 824 final 825 HRESULT 826 ComputePointAndSegmentAtLength( 827 FLOAT length, 828 UINT32 startSegment, 829 const D2D1_MATRIX_3X2_F worldTransform, 830 FLOAT flatteningTolerance, 831 D2D1_POINT_DESCRIPTION pointDescription 832 ) const 833 { 834 return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, flatteningTolerance, &pointDescription); 835 } 836 837 final 838 HRESULT 839 ComputePointAndSegmentAtLength( 840 FLOAT length, 841 UINT32 startSegment, 842 const(D2D1_MATRIX_3X2_F)* worldTransform, 843 D2D1_POINT_DESCRIPTION* pointDescription 844 ) const 845 { 846 return ComputePointAndSegmentAtLength(length, startSegment, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription); 847 } 848 849 final 850 HRESULT 851 ComputePointAndSegmentAtLength( 852 FLOAT length, 853 UINT32 startSegment, 854 const(D2D1_MATRIX_3X2_F) worldTransform, 855 D2D1_POINT_DESCRIPTION* pointDescription 856 ) const 857 { 858 return ComputePointAndSegmentAtLength(length, startSegment, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, pointDescription); 859 } 860 } // interface ID2D1PathGeometry1 861 862 863 mixin(uuid!(ID2D1Properties, "483473d7-cd46-4f9d-9d3a-3112aa80159d")); 864 /// <summary> 865 /// Represents a set of run-time bindable and discoverable properties that allow a 866 /// data-driven application to modify the state of a Direct2D effect. 867 /// </summary> 868 interface ID2D1Properties : IUnknown 869 { 870 extern(Windows): 871 /// <summary> 872 /// Returns the total number of custom properties in this interface. 873 /// </summary> 874 UINT32 GetPropertyCount() const; 875 876 /// <summary> 877 /// Retrieves the property name from the given property index. 878 /// </summary> 879 HRESULT GetPropertyName( 880 UINT32 index, 881 PWSTR name, 882 UINT32 nameCount 883 ) const; 884 885 /// <summary> 886 /// Returns the length of the property name from the given index. 887 /// </summary> 888 UINT32 GetPropertyNameLength(UINT32 index) const; 889 890 /// <summary> 891 /// Retrieves the type of the given property. 892 /// </summary> 893 D2D1_PROPERTY_TYPE GetType(UINT32 index) const; 894 895 /// <summary> 896 /// Retrieves the property index for the given property name. 897 /// </summary> 898 UINT32 GetPropertyIndex(PCWSTR name) const; 899 900 /// <summary> 901 /// Sets the value of the given property using its name. 902 /// </summary> 903 HRESULT SetValueByName( 904 PCWSTR name, 905 D2D1_PROPERTY_TYPE type, 906 const(BYTE)* data, 907 UINT32 dataSize 908 ); 909 910 /// <summary> 911 /// Sets the given value using the property index. 912 /// </summary> 913 HRESULT SetValue( 914 UINT32 index, 915 D2D1_PROPERTY_TYPE type, 916 const(BYTE)* data, 917 UINT32 dataSize 918 ); 919 920 /// <summary> 921 /// Retrieves the given property or sub-property by name. '.' is the delimiter for 922 /// sub-properties. 923 /// </summary> 924 HRESULT GetValueByName( 925 PCWSTR name, 926 D2D1_PROPERTY_TYPE type, 927 BYTE* data, 928 UINT32 dataSize 929 ) const; 930 931 /// <summary> 932 /// Retrieves the given value by index. 933 /// </summary> 934 HRESULT GetValue( 935 UINT32 index, 936 D2D1_PROPERTY_TYPE type, 937 BYTE* data, 938 UINT32 dataSize 939 ) const; 940 941 /// <summary> 942 /// Returns the value size for the given property index. 943 /// </summary> 944 UINT32 GetValueSize(UINT32 index) const; 945 946 /// <summary> 947 /// Retrieves the sub-properties of the given property by index. 948 /// </summary> 949 HRESULT GetSubProperties( 950 UINT32 index, 951 ID2D1Properties *subProperties 952 ) const; 953 954 final 955 HRESULT 956 SetValueByName( 957 PCWSTR name, 958 const(BYTE)* data, 959 UINT32 dataSize 960 ) 961 { 962 return SetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); 963 } 964 965 final 966 HRESULT 967 SetValue( 968 UINT32 index, 969 const(BYTE)* data, 970 UINT32 dataSize 971 ) 972 { 973 return SetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); 974 } 975 976 final 977 HRESULT 978 GetValueByName( 979 PCWSTR name, 980 BYTE* data, 981 UINT32 dataSize 982 ) const 983 { 984 return GetValueByName(name, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); 985 } 986 987 final 988 HRESULT 989 GetValue( 990 UINT32 index, 991 BYTE* data, 992 UINT32 dataSize 993 ) const 994 { 995 return GetValue(index, D2D1_PROPERTY_TYPE_UNKNOWN, data, dataSize); 996 } 997 998 // 999 // Templatized helper functions: 1000 // 1001 final 1002 HRESULT GetValueByName(T)( 1003 PCWSTR propertyName, 1004 T *value 1005 ) const 1006 { 1007 return GetValueByName(propertyName, cast(BYTE*)value, T.sizeof); 1008 } 1009 1010 final T GetValueByName(T)(PCWSTR propertyName) const 1011 { 1012 T value; 1013 HRESULT ignoreHr = GetValueByName(propertyName, cast(BYTE*)&value, T.sizeof); 1014 UNREFERENCED_PARAMETER(ignoreHr); 1015 1016 return value; 1017 } 1018 1019 1020 final HRESULT SetValueByName(T)( 1021 PCWSTR propertyName, 1022 const T value 1023 ) 1024 { 1025 return SetValueByName(propertyName, cast(const(BYTE)*)&value, T.sizeof); 1026 } 1027 1028 final HRESULT GetValue(U)( 1029 U index, 1030 BYTE* data, 1031 UINT32 dataSize 1032 ) const 1033 { 1034 return GetValue(cast(UINT32)index, data, dataSize); 1035 } 1036 1037 final HRESULT GetValue(T, U)(U index, T* value) const 1038 { 1039 return GetValue(cast(UINT32)index, cast(BYTE*)value, T.sizeof); 1040 } 1041 1042 final T GetValue(T, U)(U index) const 1043 { 1044 T value; 1045 HRESULT ignoreHr = GetValue(cast(UINT32)index, cast(BYTE*)&value, T.sizeof); 1046 1047 // Unreferenced variable: 1048 ignoreHr; 1049 1050 return value; 1051 } 1052 1053 final HRESULT SetValue(U)(U index, const(BYTE)* data, UINT32 dataSize) 1054 { 1055 return SetValue(cast(UINT32)index, data, dataSize); 1056 } 1057 1058 final HRESULT SetValue(T, U)(U index, const T value) 1059 { 1060 return SetValue(cast(UINT32)index, cast(const(BYTE)*)&value, T.sizeof); 1061 } 1062 1063 final HRESULT GetPropertyName(U)(U index, PWSTR name, UINT32 nameCount) const 1064 { 1065 return GetPropertyName(cast(UINT32)index, name, nameCount); 1066 } 1067 1068 final UINT32 GetPropertyNameLength(U)(U index) const 1069 { 1070 return GetPropertyNameLength(cast(UINT32)index); 1071 } 1072 1073 final D2D1_PROPERTY_TYPE GetType(U)(U index) const 1074 { 1075 return GetType(cast(UINT32)index); 1076 } 1077 1078 1079 final UINT32 GetValueSize(U)(U index) const 1080 { 1081 return GetValueSize(cast(UINT32)index); 1082 } 1083 1084 final HRESULT GetSubProperties(U)(U index, out ID2D1Properties subProperties) const 1085 { 1086 return GetSubProperties(cast(UINT32)index, &subProperties); 1087 } 1088 } // interface ID2D1Properties 1089 1090 1091 mixin(uuid!(ID2D1Effect, "28211a43-7d89-476f-8181-2d6159b220ad")); 1092 /// <summary> 1093 /// The effect interface. Properties control how the effect is rendered. The effect 1094 /// is Drawn with the DrawImage call. 1095 /// </summary> 1096 interface ID2D1Effect : ID2D1Properties 1097 { 1098 extern(Windows): 1099 /// <summary> 1100 /// Sets the input to the given effect. The input can be a concrete bitmap or the 1101 /// output of another effect. 1102 /// </summary> 1103 void SetInput( 1104 UINT32 index, 1105 ID2D1Image input, 1106 BOOL invalidate = TRUE 1107 ); 1108 1109 /// <summary> 1110 /// If the effect supports a variable number of inputs, this sets the number of 1111 /// input that are currently active on the effect. 1112 /// </summary> 1113 HRESULT SetInputCount(UINT32 inputCount); 1114 1115 /// <summary> 1116 /// Returns the input image to the effect. The input could be another effect or a 1117 /// bitmap. 1118 /// </summary> 1119 void GetInput(UINT32 index, ID2D1Image **input) const; 1120 1121 /// <summary> 1122 /// This returns the number of input that are bound into this effect. 1123 /// </summary> 1124 UINT32 GetInputCount() const; 1125 1126 /// <summary> 1127 /// Returns the output image of the given effect. This can be set as the input to 1128 /// another effect or can be drawn with DrawImage. 1129 /// </summary> 1130 void GetOutput(ID2D1Image *outputImage) const; 1131 1132 final 1133 void 1134 SetInputEffect(UINT32 index, ID2D1Effect inputEffect, BOOL invalidate = TRUE) 1135 { 1136 1137 ID2D1Image output = null; 1138 if (inputEffect !is null) inputEffect.GetOutput(&output); 1139 scope(exit) if(output !is null) output.Release(); 1140 SetInput(index, output, invalidate); 1141 } 1142 } // interface ID2D1Effect 1143 1144 1145 mixin(uuid!(ID2D1Bitmap, "28211a43-7d89-476f-8181-2d6159b220ad")); 1146 /// <summary> 1147 /// Represents a bitmap that can be used as a surface for an ID2D1DeviceContext or 1148 /// mapped into system memory, and can contain additional color context information. 1149 /// </summary> 1150 interface ID2D1Bitmap1 : ID2D1Bitmap 1151 { 1152 extern(Windows): 1153 /// <summary> 1154 /// Retrieves the color context information associated with the bitmap. 1155 /// </summary> 1156 void GetColorContext(ID2D1ColorContext *colorContext) const; 1157 1158 /// <summary> 1159 /// Retrieves the bitmap options used when creating the API. 1160 /// </summary> 1161 D2D1_BITMAP_OPTIONS GetOptions() const; 1162 1163 /// <summary> 1164 /// Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was 1165 /// created from a device derived from a D3D device. 1166 /// </summary> 1167 HRESULT GetSurface(IDXGISurface *dxgiSurface) const; 1168 1169 /// <summary> 1170 /// Maps the given bitmap into memory. The bitmap must have been created with the 1171 /// D2D1_BITMAP_OPTIONS_CPU_READ flag. 1172 /// </summary> 1173 HRESULT Map(D2D1_MAP_OPTIONS options, D2D1_MAPPED_RECT *mappedRect); 1174 1175 /// <summary> 1176 /// Unmaps the given bitmap from memory. 1177 /// </summary> 1178 HRESULT Unmap(); 1179 } // interface ID2D1Bitmap1 1180 1181 1182 mixin(uuid!(ID2D1ColorContext, "1c4820bb-5771-4518-a581-2fe4dd0ec657")); 1183 /// <summary> 1184 /// Represents a color context that can be used with an ID2D1Bitmap1 object. 1185 /// </summary> 1186 interface ID2D1ColorContext : ID2D1Resource 1187 { 1188 extern(Windows): 1189 /// <summary> 1190 /// Retrieves the color space of the color context. 1191 /// </summary> 1192 D2D1_COLOR_SPACE GetColorSpace() const; 1193 1194 /// <summary> 1195 /// Retrieves the size of the color profile, in bytes. 1196 /// </summary> 1197 UINT32 GetProfileSize() const; 1198 1199 /// <summary> 1200 /// Retrieves the color profile bytes. 1201 /// </summary> 1202 HRESULT GetProfile(BYTE* profile, UINT32 profileSize) const; 1203 } // interface ID2D1ColorContext 1204 1205 1206 mixin(uuid!(ID2D1GradientStopCollection1, "ae1572f4-5dd0-4777-998b-9279472ae63b")); 1207 /// <summary> 1208 /// Represents an collection of gradient stops that can then be the source resource 1209 /// for either a linear or radial gradient brush. 1210 /// </summary> 1211 interface ID2D1GradientStopCollection1 : ID2D1GradientStopCollection 1212 { 1213 extern(Windows): 1214 /// <summary> 1215 /// Copies the gradient stops from the collection into the caller's memory. If this 1216 /// object was created using ID2D1DeviceContext::CreateGradientStopCollection, this 1217 /// method returns the same values as were specified in the creation method. If this 1218 /// object was created using ID2D1RenderTarget::CreateGradientStopCollection, the 1219 /// stops returned here will first be transformed into the gamma space specified by 1220 /// the colorInterpolationGamma parameter. 1221 /// </summary> 1222 void GetGradientStops1(D2D1_GRADIENT_STOP* gradientStops, UINT32 gradientStopsCount) const; 1223 1224 /// <summary> 1225 /// Returns the color space in which interpolation occurs. If this object was 1226 /// created using ID2D1RenderTarget::CreateGradientStopCollection, this method 1227 /// returns the color space related to the color interpolation gamma. 1228 /// </summary> 1229 D2D1_COLOR_SPACE GetPreInterpolationSpace() const; 1230 1231 /// <summary> 1232 /// Returns the color space colors will be converted to after interpolation occurs. 1233 /// If this object was created using 1234 /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns 1235 /// D2D1_COLOR_SPACE_SRGB. 1236 /// </summary> 1237 D2D1_COLOR_SPACE GetPostInterpolationSpace() const; 1238 1239 /// <summary> 1240 /// Returns the buffer precision of this gradient. If this object was created using 1241 /// ID2D1RenderTarget::CreateGradientStopCollection, this method returns 1242 /// D2D1_BUFFER_PRECISION_8BPC_UNORM. 1243 /// </summary> 1244 D2D1_BUFFER_PRECISION GetBufferPrecision() const; 1245 1246 /// <summary> 1247 /// Returns the interpolation mode used to interpolate colors in the gradient. 1248 /// </summary> 1249 D2D1_COLOR_INTERPOLATION_MODE GetColorInterpolationMode() const; 1250 } // interface ID2D1GradientStopCollection1 1251 1252 1253 mixin(uuid!(ID2D1DrawingStateBlock1, "689f1f85-c72e-4e33-8f19-85754efd5ace")); 1254 /// <summary> 1255 /// Represents drawing state. 1256 /// </summary> 1257 interface ID2D1DrawingStateBlock1 : ID2D1DrawingStateBlock 1258 { 1259 extern(Windows): 1260 /// <summary> 1261 /// Retrieves the state currently contained within this state block resource. 1262 /// </summary> 1263 void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION1 *stateDescription) const; 1264 1265 /* using ID2D1DrawingStateBlock::GetDescription; */ 1266 void GetDescription(D2D1_DRAWING_STATE_DESCRIPTION *stateDescription) const; 1267 1268 /// <summary> 1269 /// Sets the state description of this state block resource. 1270 /// </summary> 1271 void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION1)* stateDescription); 1272 1273 /* using ID2D1DrawingStateBlock::SetDescription; */ 1274 void SetDescription(const(D2D1_DRAWING_STATE_DESCRIPTION)* stateDescription); 1275 } // interface ID2D1DrawingStateBlock1 1276 1277 1278 mixin(uuid!(ID2D1DeviceContext, "e8f7fe7a-191c-466d-ad95-975678bda998")); 1279 /// <summary> 1280 /// The device context represents a set of state and a command buffer that is used 1281 /// to render to a target bitmap. 1282 /// </summary> 1283 interface ID2D1DeviceContext : ID2D1RenderTarget 1284 { 1285 extern(Windows): 1286 /// <summary> 1287 /// Creates a bitmap with extended bitmap properties, potentially from a block of 1288 /// memory. 1289 /// </summary> 1290 HRESULT CreateBitmap( 1291 D2D1_SIZE_U size, 1292 const(void)* sourceData, 1293 UINT32 pitch, 1294 const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, 1295 ID2D1Bitmap1 *bitmap 1296 ); 1297 1298 /* using ID2D1RenderTarget::CreateBitmap; */ 1299 HRESULT CreateBitmap( 1300 D2D1_SIZE_U size, 1301 const(void*) srcData, 1302 UINT32 pitch, 1303 const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, 1304 /*out*/ID2D1Bitmap* bitmap 1305 ); 1306 1307 /// <summary> 1308 /// Create a D2D bitmap by copying a WIC bitmap. 1309 /// </summary> 1310 HRESULT CreateBitmapFromWicBitmap( 1311 IWICBitmapSource wicBitmapSource, 1312 const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, 1313 ID2D1Bitmap1 *bitmap 1314 ); 1315 1316 /* using ID2D1RenderTarget::CreateBitmapFromWicBitmap; */ 1317 HRESULT CreateBitmapFromWicBitmap( 1318 IWICBitmapSource wicBitmapSource, 1319 const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, 1320 /*out*/ ID2D1Bitmap *bitmap 1321 ); 1322 1323 /// <summary> 1324 /// Creates a color context from a color space. If the space is Custom, the context 1325 /// is initialized from the profile/profileSize arguments. Otherwise the context is 1326 /// initialized with the profile bytes associated with the space and 1327 /// profile/profileSize are ignored. 1328 /// </summary> 1329 HRESULT CreateColorContext( 1330 D2D1_COLOR_SPACE space, 1331 const(BYTE)* profile, 1332 UINT32 profileSize, 1333 ID2D1ColorContext *colorContext 1334 ); 1335 1336 HRESULT CreateColorContextFromFilename( 1337 PCWSTR filename, 1338 ID2D1ColorContext *colorContext 1339 ); 1340 1341 HRESULT CreateColorContextFromWicColorContext( 1342 IWICColorContext wicColorContext, 1343 ID2D1ColorContext *colorContext 1344 ); 1345 1346 /// <summary> 1347 /// Creates a bitmap from a DXGI surface with a set of extended properties. 1348 /// </summary> 1349 HRESULT CreateBitmapFromDxgiSurface( 1350 IDXGISurface surface, 1351 const(D2D1_BITMAP_PROPERTIES1)* bitmapProperties, 1352 ID2D1Bitmap1* bitmap 1353 ); 1354 1355 /// <summary> 1356 /// Create a new effect, the effect must either be built in or previously registered 1357 /// through ID2D1Factory1::RegisterEffectFromStream or 1358 /// ID2D1Factory1::RegisterEffectFromString. 1359 /// </summary> 1360 HRESULT CreateEffect( 1361 REFCLSID effectId, 1362 ID2D1Effect *effect 1363 ); 1364 1365 /// <summary> 1366 /// A gradient stop collection represents a set of stops in an ideal unit length. 1367 /// This is the source resource for a linear gradient and radial gradient brush. 1368 /// </summary> 1369 /// <param name="preInterpolationSpace">Specifies both the input color space and the 1370 /// space in which the color interpolation occurs.</param> 1371 /// <param name="postInterpolationSpace">Specifies the color space colors will be 1372 /// converted to after interpolation occurs.</param> 1373 /// <param name="bufferPrecision">Specifies the precision in which the gradient 1374 /// buffer will be held.</param> 1375 /// <param name="extendMode">Specifies how the gradient will be extended outside of 1376 /// the unit length.</param> 1377 /// <param name="colorInterpolationMode">Determines if colors will be interpolated 1378 /// in straight alpha or premultiplied alpha space.</param> 1379 HRESULT CreateGradientStopCollection( 1380 const(D2D1_GRADIENT_STOP)* straightAlphaGradientStops, 1381 UINT32 straightAlphaGradientStopsCount, 1382 D2D1_COLOR_SPACE preInterpolationSpace, 1383 D2D1_COLOR_SPACE postInterpolationSpace, 1384 D2D1_BUFFER_PRECISION bufferPrecision, 1385 D2D1_EXTEND_MODE extendMode, 1386 D2D1_COLOR_INTERPOLATION_MODE colorInterpolationMode, 1387 ID2D1GradientStopCollection1 *gradientStopCollection1 1388 ); 1389 1390 /* using ID2D1RenderTarget::CreateGradientStopCollection; */ 1391 HRESULT CreateGradientStopCollection( 1392 const(D2D1_GRADIENT_STOP)* gradientStops, 1393 UINT32 gradientStopsCount, 1394 1395 // 1396 // Specifies which space the color interpolation occurs in. 1397 // 1398 D2D1_GAMMA colorInterpolationGamma, 1399 1400 // 1401 // Specifies how the gradient will be extended outside of the unit length. 1402 // 1403 D2D1_EXTEND_MODE extendMode, 1404 /*out*/ ID2D1GradientStopCollection* gradientStopCollection 1405 ); 1406 1407 /// <summary> 1408 /// Creates an image brush, the input image can be any type of image, including a 1409 /// bitmap, effect and a command list. 1410 /// </summary> 1411 HRESULT CreateImageBrush( 1412 ID2D1Image image, 1413 const(D2D1_IMAGE_BRUSH_PROPERTIES)* imageBrushProperties, 1414 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 1415 ID2D1ImageBrush *imageBrush 1416 ); 1417 1418 HRESULT CreateBitmapBrush( 1419 ID2D1Bitmap bitmap, 1420 const(D2D1_BITMAP_BRUSH_PROPERTIES1)* bitmapBrushProperties, 1421 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 1422 ID2D1BitmapBrush1 *bitmapBrush 1423 ); 1424 1425 /* using ID2D1RenderTarget::CreateBitmapBrush; */ 1426 HRESULT CreateBitmapBrush( 1427 ID2D1Bitmap bitmap, 1428 const(D2D1_BITMAP_BRUSH_PROPERTIES)* bitmapBrushProperties, 1429 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 1430 /*out*/ ID2D1BitmapBrush* bitmapBrush 1431 ); 1432 1433 /// <summary> 1434 /// Creates a new command list. 1435 /// </summary> 1436 HRESULT CreateCommandList(ID2D1CommandList *commandList); 1437 1438 /// <summary> 1439 /// Indicates whether the format is supported by D2D. 1440 /// </summary> 1441 BOOL IsDxgiFormatSupported(DXGI_FORMAT format) const; 1442 1443 /// <summary> 1444 /// Indicates whether the buffer precision is supported by D2D. 1445 /// </summary> 1446 BOOL IsBufferPrecisionSupported(D2D1_BUFFER_PRECISION bufferPrecision) const; 1447 1448 /// <summary> 1449 /// This retrieves the local-space bounds in DIPs of the current image using the 1450 /// device context DPI. 1451 /// </summary> 1452 HRESULT GetImageLocalBounds( 1453 ID2D1Image image, 1454 D2D1_RECT_F* localBounds 1455 ) const; 1456 1457 /// <summary> 1458 /// This retrieves the world-space bounds in DIPs of the current image using the 1459 /// device context DPI. 1460 /// </summary> 1461 HRESULT GetImageWorldBounds( 1462 ID2D1Image image, 1463 D2D1_RECT_F* worldBounds 1464 ) const; 1465 1466 /// <summary> 1467 /// Retrieves the world-space bounds in DIPs of the glyph run using the device 1468 /// context DPI. 1469 /// </summary> 1470 HRESULT GetGlyphRunWorldBounds( 1471 D2D1_POINT_2F baselineOrigin, 1472 const(DWRITE_GLYPH_RUN)* glyphRun, 1473 DWRITE_MEASURING_MODE measuringMode, 1474 D2D1_RECT_F* bounds 1475 ) const; 1476 1477 /// <summary> 1478 /// Retrieves the device associated with this device context. 1479 /// </summary> 1480 void GetDevice(ID2D1Device *device) const; 1481 1482 /// <summary> 1483 /// Sets the target for this device context to point to the given image. The image 1484 /// can be a command list or a bitmap created with the D2D1_BITMAP_OPTIONS_TARGET 1485 /// flag. 1486 /// </summary> 1487 void SetTarget(ID2D1Image image); 1488 1489 /// <summary> 1490 /// Gets the target that this device context is currently pointing to. 1491 /// </summary> 1492 void GetTarget(ID2D1Image *image) const; 1493 1494 /// <summary> 1495 /// Sets tuning parameters for internal rendering inside the device context. 1496 /// </summary> 1497 void SetRenderingControls(const(D2D1_RENDERING_CONTROLS)* renderingControls); 1498 1499 /// <summary> 1500 /// This retrieves the rendering controls currently selected into the device 1501 /// context. 1502 /// </summary> 1503 void GetRenderingControls(D2D1_RENDERING_CONTROLS* renderingControls) const; 1504 1505 /// <summary> 1506 /// Changes the primitive blending mode for all of the rendering operations. 1507 /// </summary> 1508 void SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND primitiveBlend); 1509 1510 /// <summary> 1511 /// Returns the primitive blend currently selected into the device context. 1512 /// </summary> 1513 D2D1_PRIMITIVE_BLEND GetPrimitiveBlend() const; 1514 1515 /// <summary> 1516 /// Changes the units used for all of the rendering operations. 1517 /// </summary> 1518 void SetUnitMode(D2D1_UNIT_MODE unitMode); 1519 1520 /// <summary> 1521 /// Returns the unit mode currently set on the device context. 1522 /// </summary> 1523 D2D1_UNIT_MODE GetUnitMode() const; 1524 1525 /// <summary> 1526 /// Draws the glyph run with an extended description to describe the glyphs. 1527 /// </summary> 1528 void DrawGlyphRun( 1529 D2D1_POINT_2F baselineOrigin, 1530 const(DWRITE_GLYPH_RUN)* glyphRun, 1531 const(DWRITE_GLYPH_RUN_DESCRIPTION)* glyphRunDescription, 1532 ID2D1Brush foregroundBrush, 1533 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 1534 ); 1535 1536 /* using ID2D1RenderTarget::DrawGlyphRun; */ 1537 void DrawGlyphRun( 1538 D2D1_POINT_2F baselineOrigin, 1539 const(DWRITE_GLYPH_RUN)* glyphRun, 1540 ID2D1Brush foregroundBrush, 1541 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 1542 ); 1543 1544 /// <summary> 1545 /// Draw an image to the device context. The image represents either a concrete 1546 /// bitmap or the output of an effect graph. 1547 /// </summary> 1548 void DrawImage( 1549 ID2D1Image image, 1550 const(D2D1_POINT_2F)* targetOffset = null, 1551 const(D2D1_RECT_F)* imageRectangle = null, 1552 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1553 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1554 ); 1555 1556 /// <summary> 1557 /// Draw a metafile to the device context. 1558 /// </summary> 1559 void DrawGdiMetafile( 1560 ID2D1GdiMetafile gdiMetafile, 1561 const(D2D1_POINT_2F)* targetOffset = null 1562 ); 1563 1564 void DrawBitmap( 1565 ID2D1Bitmap bitmap, 1566 const(D2D1_RECT_F)* destinationRectangle, 1567 FLOAT opacity, 1568 D2D1_INTERPOLATION_MODE interpolationMode, 1569 const(D2D1_RECT_F)* sourceRectangle = null, 1570 const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 1571 ); 1572 1573 /* using ID2D1RenderTarget::DrawBitmap; */ 1574 void DrawBitmap( 1575 ID2D1Bitmap bitmap, 1576 const(D2D1_RECT_F)* destinationRectangle = null, 1577 FLOAT opacity = 1.0f, 1578 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, 1579 const(D2D1_RECT_F)* sourceRectangle = null 1580 ); 1581 1582 /// <summary> 1583 /// Push a layer on the device context. 1584 /// </summary> 1585 void PushLayer( 1586 const(D2D1_LAYER_PARAMETERS1)* layerParameters, 1587 ID2D1Layer layer 1588 ); 1589 1590 /* using ID2D1RenderTarget::PushLayer; */ 1591 void PushLayer( 1592 const(D2D1_LAYER_PARAMETERS)* layerParameters, 1593 ID2D1Layer layer 1594 ); 1595 1596 /// <summary> 1597 /// This indicates that a portion of an effect's input is invalid. This method can 1598 /// be called many times. 1599 /// </summary> 1600 HRESULT InvalidateEffectInputRectangle( 1601 ID2D1Effect effect, 1602 UINT32 input, 1603 const(D2D1_RECT_F)* inputRectangle 1604 ); 1605 1606 /// <summary> 1607 /// Gets the number of invalid ouptut rectangles that have accumulated at the 1608 /// effect. 1609 /// </summary> 1610 HRESULT GetEffectInvalidRectangleCount( 1611 ID2D1Effect effect, 1612 UINT32* rectangleCount 1613 ); 1614 1615 /// <summary> 1616 /// Gets the invalid rectangles that are at the output of the effect. 1617 /// </summary> 1618 HRESULT GetEffectInvalidRectangles( 1619 ID2D1Effect effect, 1620 D2D1_RECT_F* rectangles, 1621 UINT32 rectanglesCount 1622 ); 1623 1624 /// <summary> 1625 /// Gets the maximum region of each specified input which would be used during a 1626 /// subsequent rendering operation 1627 /// </summary> 1628 HRESULT GetEffectRequiredInputRectangles( 1629 ID2D1Effect* renderEffect, 1630 const(D2D1_RECT_F)* renderImageRectangle, 1631 const(D2D1_EFFECT_INPUT_DESCRIPTION)* inputDescriptions, 1632 D2D1_RECT_F* requiredInputRects, 1633 UINT32 inputCount 1634 ); 1635 1636 /// <summary> 1637 /// Fill using the alpha channel of the supplied opacity mask bitmap. The brush 1638 /// opacity will be modulated by the mask. The render target antialiasing mode must 1639 /// be set to aliased. 1640 /// </summary> 1641 void FillOpacityMask( 1642 ID2D1Bitmap opacityMask, 1643 ID2D1Brush brush, 1644 const(D2D1_RECT_F)* destinationRectangle = null, 1645 const(D2D1_RECT_F)* sourceRectangle = null 1646 ); 1647 1648 /* using ID2D1RenderTarget::FillOpacityMask; */ 1649 void FillOpacityMask( 1650 ID2D1Bitmap opacityMask, 1651 ID2D1Brush brush, 1652 D2D1_OPACITY_MASK_CONTENT content, 1653 const(D2D1_RECT_F)* destinationRectangle = null, 1654 const(D2D1_RECT_F)* sourceRectangle = null 1655 ); 1656 1657 final 1658 HRESULT 1659 CreateBitmap( 1660 D2D1_SIZE_U size, 1661 const(void)* sourceData, 1662 UINT32 pitch, 1663 const D2D1_BITMAP_PROPERTIES1 bitmapProperties, 1664 out ID2D1Bitmap1 bitmap 1665 ) 1666 { 1667 return CreateBitmap(size, sourceData, pitch, &bitmapProperties, &bitmap); 1668 } 1669 1670 /// <summary> 1671 /// Create a D2D bitmap by copying a WIC bitmap. 1672 /// </summary> 1673 final 1674 HRESULT 1675 CreateBitmapFromWicBitmap( 1676 IWICBitmapSource wicBitmapSource, 1677 const D2D1_BITMAP_PROPERTIES1 bitmapProperties, 1678 out ID2D1Bitmap1 bitmap 1679 ) 1680 { 1681 return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, &bitmap); 1682 } 1683 1684 /// <summary> 1685 /// Create a D2D bitmap by copying a WIC bitmap. 1686 /// </summary> 1687 final 1688 HRESULT 1689 CreateBitmapFromWicBitmap( 1690 IWICBitmapSource wicBitmapSource, 1691 out ID2D1Bitmap1 bitmap 1692 ) 1693 { 1694 return CreateBitmapFromWicBitmap(wicBitmapSource, null, &bitmap); 1695 } 1696 1697 final 1698 HRESULT 1699 CreateBitmapFromDxgiSurface( 1700 IDXGISurface surface, 1701 const D2D1_BITMAP_PROPERTIES1 bitmapProperties, 1702 out ID2D1Bitmap1 bitmap 1703 ) 1704 { 1705 return CreateBitmapFromDxgiSurface(surface, &bitmapProperties, &bitmap); 1706 } 1707 1708 final 1709 HRESULT 1710 CreateImageBrush( 1711 ID2D1Image image, 1712 const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, 1713 const D2D1_BRUSH_PROPERTIES brushProperties, 1714 out ID2D1ImageBrush imageBrush 1715 ) 1716 { 1717 return CreateImageBrush(image, &imageBrushProperties, &brushProperties, &imageBrush); 1718 } 1719 1720 final 1721 HRESULT 1722 CreateImageBrush( 1723 ID2D1Image image, 1724 const D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, 1725 out ID2D1ImageBrush imageBrush 1726 ) 1727 { 1728 return CreateImageBrush(image,&imageBrushProperties, null, &imageBrush); 1729 } 1730 1731 final 1732 HRESULT 1733 CreateBitmapBrush( 1734 ID2D1Bitmap bitmap, 1735 out ID2D1BitmapBrush1 bitmapBrush 1736 ) 1737 { 1738 return CreateBitmapBrush(bitmap, null, null, &bitmapBrush); 1739 } 1740 1741 final 1742 HRESULT 1743 CreateBitmapBrush( 1744 ID2D1Bitmap bitmap, 1745 const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties, 1746 out ID2D1BitmapBrush1 bitmapBrush 1747 ) 1748 { 1749 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, null, &bitmapBrush); 1750 } 1751 1752 final 1753 HRESULT 1754 CreateBitmapBrush( 1755 ID2D1Bitmap bitmap, 1756 const D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrushProperties, 1757 const D2D1_BRUSH_PROPERTIES brushProperties, 1758 out ID2D1BitmapBrush1 bitmapBrush 1759 ) 1760 { 1761 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, &bitmapBrush); 1762 } 1763 1764 /// <summary> 1765 /// Draws the output of the effect as an image. 1766 /// </summary> 1767 final 1768 void 1769 DrawImage( 1770 ID2D1Effect effect, 1771 const(D2D1_POINT_2F)* targetOffset = null, 1772 const(D2D1_RECT_F)* imageRectangle = null, 1773 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1774 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1775 ) 1776 { 1777 1778 ID2D1Image output = null; 1779 effect.GetOutput(&output); scope(exit) output.Release(); 1780 DrawImage(output, targetOffset, imageRectangle, interpolationMode, compositeMode); 1781 } 1782 1783 final 1784 void 1785 DrawImage( 1786 ID2D1Image image, 1787 D2D1_INTERPOLATION_MODE interpolationMode, 1788 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1789 ) 1790 { 1791 DrawImage(image, null, null, interpolationMode, compositeMode); 1792 } 1793 1794 final 1795 void 1796 DrawImage( 1797 ID2D1Effect effect, 1798 D2D1_INTERPOLATION_MODE interpolationMode, 1799 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1800 ) 1801 { 1802 DrawImage(effect, null, null, interpolationMode, compositeMode); 1803 } 1804 1805 final 1806 void 1807 DrawImage( 1808 ID2D1Image image, 1809 D2D1_POINT_2F targetOffset, 1810 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1811 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1812 ) 1813 { 1814 DrawImage(image, &targetOffset, null, interpolationMode, compositeMode); 1815 } 1816 1817 final 1818 void 1819 DrawImage( 1820 ID2D1Effect effect, 1821 D2D1_POINT_2F targetOffset, 1822 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1823 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1824 ) 1825 { 1826 DrawImage(effect, &targetOffset, null, interpolationMode, compositeMode); 1827 } 1828 1829 final 1830 void 1831 DrawImage( 1832 ID2D1Image image, 1833 D2D1_POINT_2F targetOffset, 1834 const D2D1_RECT_F imageRectangle, 1835 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1836 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1837 ) 1838 { 1839 DrawImage(image, &targetOffset, &imageRectangle, interpolationMode, compositeMode); 1840 } 1841 1842 final 1843 void 1844 DrawImage( 1845 ID2D1Effect effect, 1846 D2D1_POINT_2F targetOffset, 1847 const D2D1_RECT_F imageRectangle, 1848 D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, 1849 D2D1_COMPOSITE_MODE compositeMode = D2D1_COMPOSITE_MODE_SOURCE_OVER 1850 ) 1851 { 1852 DrawImage(effect, &targetOffset, &imageRectangle, interpolationMode, compositeMode); 1853 } 1854 1855 final 1856 void 1857 PushLayer( 1858 const D2D1_LAYER_PARAMETERS1 layerParameters, 1859 ID2D1Layer layer 1860 ) 1861 { 1862 PushLayer(&layerParameters, layer); 1863 } 1864 1865 final 1866 void 1867 DrawGdiMetafile( 1868 ID2D1GdiMetafile gdiMetafile, 1869 D2D1_POINT_2F targetOffset 1870 ) 1871 { 1872 DrawGdiMetafile(gdiMetafile, &targetOffset); 1873 } 1874 1875 final 1876 void 1877 DrawBitmap( 1878 ID2D1Bitmap bitmap, 1879 const D2D1_RECT_F destinationRectangle, 1880 FLOAT opacity, 1881 D2D1_INTERPOLATION_MODE interpolationMode, 1882 const(D2D1_RECT_F)* sourceRectangle = null, 1883 const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 1884 ) 1885 { 1886 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle, perspectiveTransform); 1887 } 1888 1889 final 1890 void 1891 DrawBitmap( 1892 ID2D1Bitmap bitmap, 1893 const D2D1_RECT_F destinationRectangle, 1894 FLOAT opacity, 1895 D2D1_INTERPOLATION_MODE interpolationMode, 1896 const D2D1_RECT_F sourceRectangle, 1897 const(D2D1_MATRIX_4X4_F)* perspectiveTransform = null 1898 ) 1899 { 1900 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, perspectiveTransform); 1901 } 1902 1903 final 1904 void 1905 DrawBitmap( 1906 ID2D1Bitmap bitmap, 1907 const D2D1_RECT_F destinationRectangle, 1908 FLOAT opacity, 1909 D2D1_INTERPOLATION_MODE interpolationMode, 1910 const D2D1_RECT_F sourceRectangle, 1911 const D2D1_MATRIX_4X4_F perspectiveTransform 1912 ) 1913 { 1914 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle, &perspectiveTransform); 1915 } 1916 1917 final 1918 void 1919 FillOpacityMask( 1920 ID2D1Bitmap opacityMask, 1921 ID2D1Brush brush, 1922 const D2D1_RECT_F destinationRectangle, 1923 const(D2D1_RECT_F)* sourceRectangle = null 1924 ) 1925 { 1926 FillOpacityMask(opacityMask, brush, &destinationRectangle, sourceRectangle); 1927 } 1928 1929 final 1930 void 1931 FillOpacityMask( 1932 ID2D1Bitmap opacityMask, 1933 ID2D1Brush brush, 1934 const D2D1_RECT_F destinationRectangle, 1935 const D2D1_RECT_F sourceRectangle 1936 ) 1937 { 1938 FillOpacityMask(opacityMask, brush, &destinationRectangle, &sourceRectangle); 1939 } 1940 1941 /// <summary> 1942 /// Sets tuning parameters for internal rendering inside the device context. 1943 /// </summary> 1944 final 1945 void 1946 SetRenderingControls( 1947 const D2D1_RENDERING_CONTROLS renderingControls 1948 ) 1949 { 1950 return SetRenderingControls(&renderingControls); 1951 } 1952 } // interface ID2D1DeviceContext 1953 1954 1955 mixin(uuid!(ID2D1Device, "47dd575d-ac05-4cdd-8049-9b02cd16f44c")); 1956 /// <summary> 1957 /// The device defines a resource domain whose objects and device contexts can be 1958 /// used together. 1959 /// </summary> 1960 interface ID2D1Device : ID2D1Resource 1961 { 1962 extern(Windows): 1963 /// <summary> 1964 /// Creates a new device context with no initially assigned target. 1965 /// </summary> 1966 HRESULT CreateDeviceContext( 1967 D2D1_DEVICE_CONTEXT_OPTIONS options, 1968 ID2D1DeviceContext *deviceContext 1969 ); 1970 1971 /// <summary> 1972 /// Creates a D2D print control. 1973 /// </summary> 1974 HRESULT CreatePrintControl( 1975 IWICImagingFactory wicFactory, 1976 IPrintDocumentPackageTarget documentTarget, 1977 const(D2D1_PRINT_CONTROL_PROPERTIES)* printControlProperties, 1978 ID2D1PrintControl *printControl 1979 ); 1980 1981 /// <summary> 1982 /// Sets the maximum amount of texture memory to maintain before evicting caches. 1983 /// </summary> 1984 void SetMaximumTextureMemory(UINT64 maximumInBytes); 1985 1986 /// <summary> 1987 /// Gets the maximum amount of texture memory to maintain before evicting caches. 1988 /// </summary> 1989 UINT64 GetMaximumTextureMemory() const; 1990 1991 /// <summary> 1992 /// Clears all resources that are cached but not held in use by the application 1993 /// through an interface reference. 1994 /// </summary> 1995 void ClearResources(UINT32 millisecondsSinceUse = 0); 1996 1997 final 1998 HRESULT 1999 CreatePrintControl( 2000 IWICImagingFactory wicFactory, 2001 IPrintDocumentPackageTarget documentTarget, 2002 const D2D1_PRINT_CONTROL_PROPERTIES printControlProperties, 2003 out ID2D1PrintControl printControl 2004 ) 2005 { 2006 return CreatePrintControl(wicFactory, documentTarget, &printControlProperties, &printControl); 2007 } 2008 } // interface ID2D1Device 2009 2010 2011 mixin(uuid!(ID2D1Factory1, "bb12d362-daee-4b9a-aa1d-14ba401cfa1f")); 2012 /// <summary> 2013 /// Creates Direct2D resources. 2014 /// </summary> 2015 interface ID2D1Factory1 : ID2D1Factory 2016 { 2017 extern(Windows): 2018 /// <summary> 2019 /// This creates a new Direct2D device from the given IDXGIDevice. 2020 /// </summary> 2021 HRESULT CreateDevice( 2022 IDXGIDevice dxgiDevice, 2023 ID2D1Device *d2dDevice 2024 ); 2025 2026 /// <summary> 2027 /// This creates a stroke style with the ability to preserve stroke width in various 2028 /// ways. 2029 /// </summary> 2030 HRESULT CreateStrokeStyle( 2031 const(D2D1_STROKE_STYLE_PROPERTIES1)* strokeStyleProperties, 2032 const(FLOAT)* dashes, 2033 UINT32 dashesCount, 2034 ID2D1StrokeStyle1 *strokeStyle 2035 ); 2036 2037 /* using ID2D1Factory::CreateStrokeStyle; */ 2038 HRESULT CreateStrokeStyle( 2039 const(D2D1_STROKE_STYLE_PROPERTIES)* strokeStyleProperties, 2040 const(FLOAT)* dashes, 2041 UINT32 dashesCount, 2042 /*out*/ ID2D1StrokeStyle* strokeStyle 2043 ); 2044 2045 /// <summary> 2046 /// Creates a path geometry with new operational methods. 2047 /// </summary> 2048 HRESULT CreatePathGeometry(ID2D1PathGeometry1 *pathGeometry); 2049 2050 /* using ID2D1Factory::CreatePathGeometry; */ 2051 HRESULT CreatePathGeometry( 2052 /*out*/ ID2D1PathGeometry* pathGeometry 2053 ); 2054 2055 /// <summary> 2056 /// Creates a new drawing state block, this can be used in subsequent 2057 /// SaveDrawingState and RestoreDrawingState operations on the render target. 2058 /// </summary> 2059 HRESULT CreateDrawingStateBlock( 2060 const(D2D1_DRAWING_STATE_DESCRIPTION1)* drawingStateDescription, 2061 IDWriteRenderingParams textRenderingParams, 2062 ID2D1DrawingStateBlock1 *drawingStateBlock 2063 ); 2064 2065 /* using ID2D1Factory::CreateDrawingStateBlock; */ 2066 HRESULT CreateDrawingStateBlock( 2067 const(D2D1_DRAWING_STATE_DESCRIPTION)* drawingStateDescription, 2068 IDWriteRenderingParams textRenderingParams, 2069 /*out*/ ID2D1DrawingStateBlock* drawingStateBlock 2070 ); 2071 2072 /// <summary> 2073 /// Creates a new GDI metafile. 2074 /// </summary> 2075 HRESULT CreateGdiMetafile( 2076 IStream metafileStream, 2077 ID2D1GdiMetafile *metafile 2078 ); 2079 2080 /// <summary> 2081 /// This globally registers the given effect. The effect can later be instantiated 2082 /// by using the registered class id. The effect registration is reference counted. 2083 /// </summary> 2084 HRESULT RegisterEffectFromStream( 2085 REFCLSID classId, 2086 IStream propertyXml, 2087 const(D2D1_PROPERTY_BINDING)* bindings, 2088 UINT32 bindingsCount, 2089 const PD2D1_EFFECT_FACTORY effectFactory 2090 ); 2091 2092 /// <summary> 2093 /// This globally registers the given effect. The effect can later be instantiated 2094 /// by using the registered class id. The effect registration is reference counted. 2095 /// </summary> 2096 HRESULT RegisterEffectFromString( 2097 REFCLSID classId, 2098 PCWSTR propertyXml, 2099 const(D2D1_PROPERTY_BINDING)* bindings, 2100 UINT32 bindingsCount, 2101 const PD2D1_EFFECT_FACTORY effectFactory 2102 ); 2103 2104 /// <summary> 2105 /// This unregisters the given effect by its class id, you need to call 2106 /// UnregisterEffect for every call to ID2D1Factory1::RegisterEffectFromStream and 2107 /// ID2D1Factory1::RegisterEffectFromString to completely unregister it. 2108 /// </summary> 2109 HRESULT UnregisterEffect(REFCLSID classId); 2110 2111 /// <summary> 2112 /// This returns all of the registered effects in the process, including any 2113 /// built-in effects. 2114 /// </summary> 2115 /// <param name="effectsReturned">The number of effects returned into the passed in 2116 /// effects array.</param> 2117 /// <param name="effectsRegistered">The number of effects currently registered in 2118 /// the system.</param> 2119 HRESULT GetRegisteredEffects( 2120 CLSID* effects, 2121 UINT32 effectsCount, 2122 UINT32* effectsReturned, 2123 UINT32* effectsRegistered 2124 ) const; 2125 2126 /// <summary> 2127 /// This retrieves the effect properties for the given effect, all of the effect 2128 /// properties will be set to a default value since an effect is not instantiated to 2129 /// implement the returned property interface. 2130 /// </summary> 2131 HRESULT GetEffectProperties( 2132 REFCLSID effectId, 2133 ID2D1Properties *properties 2134 ) const; 2135 2136 final 2137 HRESULT 2138 CreateStrokeStyle( 2139 const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties, 2140 const(FLOAT)* dashes, 2141 UINT32 dashesCount, 2142 out ID2D1StrokeStyle1 strokeStyle 2143 ) 2144 { 2145 return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, &strokeStyle); 2146 } 2147 // D-style impl 2148 final 2149 HRESULT 2150 CreateStrokeStyle( 2151 const D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties, 2152 const(FLOAT)[] dashes, 2153 out ID2D1StrokeStyle1 strokeStyle 2154 ) 2155 { 2156 return CreateStrokeStyle(&strokeStyleProperties, &dashes[0], cast(UINT32)dashes.length, &strokeStyle); 2157 } 2158 2159 final 2160 HRESULT 2161 CreateDrawingStateBlock( 2162 const D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription, 2163 out ID2D1DrawingStateBlock1 drawingStateBlock 2164 ) 2165 { 2166 return CreateDrawingStateBlock(&drawingStateDescription, null, &drawingStateBlock); 2167 } 2168 2169 final 2170 HRESULT 2171 CreateDrawingStateBlock(out ID2D1DrawingStateBlock1 drawingStateBlock) 2172 { 2173 return CreateDrawingStateBlock(null, null, &drawingStateBlock); 2174 } 2175 } // interface ID2D1Factory1 2176 2177 2178 mixin(uuid!(ID2D1Multithread, "31e6e7bc-e0ff-4d46-8c64-a0a8c41c15d3")); 2179 /// <summary> 2180 /// A locking mechanism from a Direct2D factory that Direct2D uses to control 2181 /// exclusive resource access in an app that is uses multiple threads. 2182 /// </summary> 2183 interface ID2D1Multithread : IUnknown 2184 { 2185 extern(Windows): 2186 /// <summary> 2187 /// Returns whether the D2D factory was created with 2188 /// D2D1_FACTORY_TYPE_MULTI_THREADED. 2189 /// </summary> 2190 BOOL GetMultithreadProtected() const; 2191 2192 /// <summary> 2193 /// Enters the D2D API critical section, if it exists. 2194 /// </summary> 2195 void Enter(); 2196 2197 /// <summary> 2198 /// Leaves the D2D API critical section, if it exists. 2199 /// </summary> 2200 void Leave(); 2201 } // interface ID2D1Multithread 2202 2203 extern(Windows) 2204 { 2205 HRESULT 2206 D2D1CreateDevice( 2207 IDXGIDevice dxgiDevice, 2208 const(D2D1_CREATION_PROPERTIES)* creationProperties, 2209 ID2D1Device *d2dDevice 2210 ); 2211 2212 HRESULT 2213 D2D1CreateDeviceContext( 2214 IDXGISurface dxgiSurface, 2215 const(D2D1_CREATION_PROPERTIES)* creationProperties, 2216 ID2D1DeviceContext *d2dDeviceContext 2217 ); 2218 2219 D2D1_COLOR_F 2220 D2D1ConvertColorSpace( 2221 D2D1_COLOR_SPACE sourceColorSpace, 2222 D2D1_COLOR_SPACE destinationColorSpace, 2223 const(D2D1_COLOR_F)* color 2224 ); 2225 2226 void 2227 D2D1SinCos( 2228 FLOAT angle, 2229 FLOAT* s, 2230 FLOAT* c 2231 ); 2232 2233 FLOAT 2234 D2D1Tan(FLOAT angle); 2235 2236 FLOAT 2237 D2D1Vec3Length( 2238 FLOAT x, 2239 FLOAT y, 2240 FLOAT z 2241 ); 2242 } 2243 2244 // public import D2D1 = directx.d2d1_1helper; TODO: Resolve namespace translation 2245 2246 HRESULT 2247 D2D1CreateDevice()( 2248 IDXGIDevice dxgiDevice, 2249 const D2D1_CREATION_PROPERTIES creationProperties, 2250 out ID2D1Device d2dDevice 2251 ) 2252 { 2253 2254 return 2255 D2D1CreateDevice( 2256 dxgiDevice, 2257 &creationProperties, 2258 &d2dDevice); 2259 } 2260 2261 HRESULT 2262 D2D1CreateDeviceContext()( 2263 IDXGISurface dxgiSurface, 2264 const D2D1_CREATION_PROPERTIES creationProperties, 2265 out ID2D1DeviceContext d2dDeviceContext 2266 ) 2267 { 2268 return 2269 D2D1CreateDeviceContext( 2270 dxgiSurface, 2271 &creationProperties, 2272 &d2dDeviceContext); 2273 }